# coding:utf8
from django.http import HttpResponse
from django.http.response import HttpResponseRedirect
from django.shortcuts import redirect
from django.views.decorators.cache import cache_page, cache_control
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework import serializers, status
from game_api.mid_class.usr_ import *



@api_view(['GET', 'POST', ])
def cate_list(request):
    '''单个分类列表'''
    if request.method == 'GET':
        req = request.GET
        q=game_cate_list(req)
    res_data = Response(q, status.HTTP_202_ACCEPTED)
    return res_data

@api_view(['GET', 'POST', ])
def top(request):
    '''排行榜'''
    if request.method == 'GET':
        req = request.GET
        q=game_top(req)
    res_data = Response(q, status.HTTP_202_ACCEPTED)
    return res_data


@api_view(['GET', 'POST', ])
def onedetail(request):
    '''查询单条游戏详情'''
    if request.method == 'GET':
        req = request.GET
        q=game_one(req)
    res_data = Response(q, status.HTTP_202_ACCEPTED)
    return res_data

@api_view(['GET', 'POST', ])
def cate_lists(request):
    '''所有分类列表'''
    if request.method == 'GET':
        req = request.GET
        q=game_cate_lists(req)
    res_data = Response(q, status.HTTP_202_ACCEPTED)
    return res_data


@api_view(['GET', 'POST', ])
def tuijian(request):
    '''是否推荐'''
    if request.method == 'GET':
        req = request.GET
        q = game_tuijian(req)
    res_data = Response(q, status.HTTP_202_ACCEPTED)
    return res_data

@api_view(['GET', 'POST', ])
def sousuo(request):
    '''搜索'''
    if request.method == 'GET':
        req = request.GET
        q = game_sousuo(req)
    res_data = Response(q, status.HTTP_202_ACCEPTED)
    return res_data